package com.zscat.mallplus.utils;

import java.sql.*;

public class LockUtil {

    public static Connection getConnection() throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://101.132.149.90:3306/majiang?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false";
        return DriverManager.getConnection(url, "hanfei", "hanfei114@");
    }

    public static String getToken() throws Exception {
        Connection con = getConnection();
        Statement stmt = con.createStatement();
        String sql = "select * from qsg_device where device_type = 2";
        ResultSet rs = stmt.executeQuery(sql);
        String token = "";
        while(rs.next()) {
            token = rs.getNString("token");
        }
        rs.close();
        stmt.close();
        con.close();
        return token;
    }


    public static void main(String[] args) throws Exception{
        getToken();
    }
}
